<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/common/taglibs.jsp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>资源管理</title>
    <%@ include file="/common/meta.jsp" %>
    <%@ include file="/common/public_input.jsp" %>
    <script type="text/javascript" src="${ctx}/js/authoritySearch.js"></script>

    <script>
        $(document).ready(function () {
            //聚焦第一个输入框
            //$("#loginName").focus();
            //为inputForm注册validate函数
            $("#inputForm").validate({
                rules:{

                    name:{
                        required:true,
                        remote:"check_resource_name.action?oldResourceName=" + $("#oldResourceName").val()
                    },
                    authNames:"required"

                },
                messages:{
                    name:{
                        remote:"资源名已存在"
                    }

                }

            });
        });
    </script>
</head>

<body>
<div class="div-tabs-nav">
    <ul class="ui-tabs-nav">
        <li class="ui-tabs-selected">系统资源信息</li>
    </ul>
</div>
<%--<h3><s:if test="id == null">创建</s:if><s:else>修改</s:else>资源</h3>
<div id="inputContent">--%>
<div class="ui-tabs-panel">
    <form id="inputForm" action="${ctx}/auth/resource/save.action" method="post">
        <div id="message"><s:actionmessage theme="custom" cssClass="success"/></div>
        <div>系统资源<s:if test="id!=null">信息</s:if><s:else>创建</s:else></div>
        <input type="hidden" name="id" value="${id}"/>
        <input type="hidden" id="oldResourceName" name="oldResourceName" value="${name}"/>
        <table>
            <tr>
                <td>资源类型:</td>
                <td>
                    <select name="type" value="${resourceType}">
                        <option value="url" selected="selected">URL</option>
                        <option value="menu">Menu</option>
                    </select>
                </td>
            </tr>
            <tr>
                <td>资源名称:</td>
                <td><s:textfield name="name" size="40" class="required"/></td>
            </tr>

            <tr>
                <td>资源值:</td>
                <td><s:textfield name="value" size="40" class="required"/></td>
            </tr>
            <tr>
                <td>资源位置:</td>
                <td><s:textfield name="priority" size="40"/></td>
            </tr>

            <tr>
                <td>授予给权限:</td>
                <td><s:textfield id="authNames" name="authNames" size="40" readonly="true"/>
                    <img src="${ctx}/img/icon/select.png" id="searchSrc" title="选择权限"/>
                </td>

            </tr>
        </table>
        <iframe id="inner" src="" style="z-index:10000;">
        </iframe>
        <div align="left">
            <security:authorize ifAnyGranted="AUTH_MANAGER_AUTH,AUTH_ALL">
                <input class="button" type="submit" value="提交"/>&nbsp;
            </security:authorize>
            <input type="reset" class="input-button" value="重置"/>
        </div>
    </form>
</div>

</body>
</html>